package com.jajahome.widget;

import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.view.View;

/**
 * @author lhz
 * Des  :
 * Time :2020/7/2 09:57
 */
public class NoLineClickSpan extends ClickableSpan {
    private OnSpanClickedListener onSpanClickedListener;

    public NoLineClickSpan(OnSpanClickedListener onSpanClickedListener) {
        super();
        this.onSpanClickedListener = onSpanClickedListener;
    }


    @Override
    public void updateDrawState(TextPaint ds) {
        ds.setColor(ds.linkColor);
        ds.setUnderlineText(false);
    }

    @Override
    public void onClick(View view) {
        if (onSpanClickedListener != null) {
            onSpanClickedListener.onClicked(view);
        }
    }

    public interface OnSpanClickedListener {
        void onClicked(View view);
    }

}
